﻿// Data type enum

BM.DataType = function () { };
BM.DataType.prototype =
{
    None: 0,
    Item: 1,
    Node: 2,
    Document: 3,
    Element: 4,
    Attribute: 5,
    Namespace: 6,
    ProcessingInstruction: 7,
    Comment: 8,
    Text: 9,
    AnyAtomicType: 10,
    UntypedAtomic: 11,
    String: 12,
    Boolean: 13,
    Decimal: 14,
    Float: 15,
    Double: 16,
    Duration: 17,
    DateTime: 18,
    Time: 19,
    Date: 20,
    GYearMonth: 21,
    GYear: 22,
    GMonthDay: 23,
    GDay: 24,
    GMonth: 25,
    HexBinary: 26,
    Base64Binary: 27,
    AnyUri: 28,
    QName: 29,
    Notation: 30,
    NormalizedString: 31,
    Token: 32,
    Language: 33,
    NmToken: 34,
    Name: 35,
    NCName: 36,
    Id: 37,
    Idref: 38,
    Entity: 39,
    Integer: 40,
    NonPositiveInteger: 41,
    NegativeInteger: 42,
    Long: 43,
    Int: 44,
    Short: 45,
    Byte: 46,
    NonNegativeInteger: 47,
    UnsignedLong: 48,
    UnsignedInt: 49,
    UnsignedShort: 50,
    UnsignedByte: 51,
    PositiveInteger: 52,
    YearMonthDuration: 53,
    DayTimeDuration: 54
}

BM.DataType.registerEnum("BM.DataType", false);

BM.DataType.isDateDataType = function (dataType) {
    if (dataType == BM.DataType.Date) return true;
    if (dataType == BM.DataType.DateTime) return true;
    if (dataType == BM.DataType.GYear) return true;
    if (dataType == BM.DataType.GYearMonth) return true;
    if (dataType == BM.DataType.GMonth) return true;
    if (dataType == BM.DataType.GDay) return true;
    if (dataType == BM.DataType.GMonthDay) return true;
    if (dataType == BM.DataType.Time) return true;
    return false;
}

BM.DataType.isBooleanDataType = function (dataType) {
    return dataType == BM.DataType.Boolean;
}

BM.DataType.isNumberDataType = function (dataType) {
    switch (dataType) {
        case BM.DataType.Int:
        case BM.DataType.Integer:
        case BM.DataType.NonNegativeInteger:
        case BM.DataType.NonPositiveInteger:
        case BM.DataType.PositiveInteger:
        case BM.DataType.NegativeInteger:
        case BM.DataType.Float:
        case BM.DataType.Decimal:
        case BM.DataType.Double:
            return true;
    }
    return false;
}